package com.wyp168.common.annotation;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.Signature;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;

import java.lang.reflect.Method;

@Slf4j
public class OperationAspect {
    @Pointcut("@annotation(com.wyp168.common.annotation.Operation)")
    public void operationPointCut() {

    }

    @Around(value = "operationPointCut()")
    public void around(JoinPoint joinPoint) {
        log.warn("进入到切面通知方法中...");
        log.info("joinPoint: {}", joinPoint.toString());
        Signature signature = joinPoint.getSignature();
        log.info("signature: {}", signature.toString());
        MethodSignature methodSignature = (MethodSignature) signature;
        log.info("methodSignature: {}", methodSignature.toString());
        Method method = methodSignature.getMethod();
        log.info("method: {}", method.toString());
        log.warn("通知方法结束...");
    }


}
